#include <iostream>

using namespace std;

int binaryChop(int arr[], int len, int key)
{
    int low=0;
    int high=len-1;
    int mid=0;
    while(low <= high)
    {
        mid=(low+high)/2;
        if(arr[mid]==key) return mid;
        else if(arr[mid] > key) high=mid-1;
        else low=mid+1; 
    }
    return -1;
}

int main(void)
{
    int a[10] = {2, 19, 24, 35, 43, 56, 61, 79, 83, 97};
    int result = binaryChop(a, 10, 79);
    cout << result << endl;
    return 0;
}
